/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package py.una.pol.ii.is2.domain.flota;

import py.una.pol.ii.is2.domain.taller.DetalleOrdenMantenimientoInsumo;
import java.io.Serializable;
import java.math.BigInteger;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 *
 * @author markos
 */
@Entity
@Table(name = "insumo")
@NamedQueries({@NamedQuery(name = "Insumo.findAll", query = "SELECT i FROM Insumo i"), @NamedQuery(name = "Insumo.findByInsuCod", query = "SELECT i FROM Insumo i WHERE i.insuCod = :insuCod"), @NamedQuery(name = "Insumo.findByInsuNombre", query = "SELECT i FROM Insumo i WHERE i.insuNombre = :insuNombre"), @NamedQuery(name = "Insumo.findByInsuPrecio", query = "SELECT i FROM Insumo i WHERE i.insuPrecio = :insuPrecio"), @NamedQuery(name = "Insumo.findByInsuDescripcion", query = "SELECT i FROM Insumo i WHERE i.insuDescripcion = :insuDescripcion")})
public class Insumo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="insumo_generator")
    @SequenceGenerator(name="insumo_generator", sequenceName="insumo_insu_cod_seq", allocationSize=1)
    @Basic(optional = false)
    @Column(name = "insu_cod")
    private Integer insuCod;
    @Basic(optional = false)
    @Column(name = "insu_nombre")
    private String insuNombre;
    @Basic(optional = false)
    @Column(name = "insu_precio")
    private BigInteger insuPrecio;
    @Basic(optional = false)
    @Column(name = "insu_descripcion")
    private String insuDescripcion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "deoiCodInsumo")
    private Collection<DetalleOrdenMantenimientoInsumo> detalleOrdenMantenimientoInsumoCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "depmCodInsumo")
    private Collection<DetallePlantillaMantenimiento> detallePlantillaMantenimientoCollection;

    public Insumo() {
    }

    public Insumo(Integer insuCod) {
        this.insuCod = insuCod;
    }

    public Insumo(Integer insuCod, String insuNombre, BigInteger insuPrecio, String insuDescripcion) {
        this.insuCod = insuCod;
        this.insuNombre = insuNombre;
        this.insuPrecio = insuPrecio;
        this.insuDescripcion = insuDescripcion;
    }

    public Integer getInsuCod() {
        return insuCod;
    }

    public void setInsuCod(Integer insuCod) {
        this.insuCod = insuCod;
    }

    public String getInsuNombre() {
        return insuNombre;
    }

    public void setInsuNombre(String insuNombre) {
        this.insuNombre = insuNombre;
    }

    public BigInteger getInsuPrecio() {
        return insuPrecio;
    }

    public void setInsuPrecio(BigInteger insuPrecio) {
        this.insuPrecio = insuPrecio;
    }

    public String getInsuDescripcion() {
        return insuDescripcion;
    }

    public void setInsuDescripcion(String insuDescripcion) {
        this.insuDescripcion = insuDescripcion;
    }

    public Collection<DetalleOrdenMantenimientoInsumo> getDetalleOrdenMantenimientoInsumoCollection() {
        return detalleOrdenMantenimientoInsumoCollection;
    }

    public void setDetalleOrdenMantenimientoInsumoCollection(Collection<DetalleOrdenMantenimientoInsumo> detalleOrdenMantenimientoInsumoCollection) {
        this.detalleOrdenMantenimientoInsumoCollection = detalleOrdenMantenimientoInsumoCollection;
    }

    public Collection<DetallePlantillaMantenimiento> getDetallePlantillaMantenimientoCollection() {
        return detallePlantillaMantenimientoCollection;
    }

    public void setDetallePlantillaMantenimientoCollection(Collection<DetallePlantillaMantenimiento> detallePlantillaMantenimientoCollection) {
        this.detallePlantillaMantenimientoCollection = detallePlantillaMantenimientoCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (insuCod != null ? insuCod.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Insumo)) {
            return false;
        }
        Insumo other = (Insumo) object;
        if ((this.insuCod == null && other.insuCod != null) || (this.insuCod != null && !this.insuCod.equals(other.insuCod))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "py.una.pol.ii.is2.dao.flota.Insumo[insuCod=" + insuCod + "]";
    }

}
